--- file.c.orig	2013-07-09 17:06:21.000000000 -0700
+++ file.c	2018-06-14 22:20:32.667616957 -0700
@@ -759,7 +759,7 @@ bool called_from_get_command;
       if (feof(fp))
       {
          eof_reached = TRUE;
-         for (;*(trec+read_start+chars_read-1)==DOSEOF;chars_read--)
+         for (;chars_read>0 && *(trec+read_start+chars_read-1)==DOSEOF;chars_read--)
             ;
       }
       /*
